<?php
/**
 * Created by PhpStorm.
 * User: baidu
 * Date: 17/8/5
 * Time: 下午4:37
 */
namespace app\api\controller\v1;

use app\api\controller\Common;
use think\Controller;
// use app\common\lib\exception\ApiException;
// use app\common\lib\Aes;

class Rank extends Common {

  /**
   * [index 获取排行榜数据列表]
   * 1.获取数据库 然后 read_count排序
   * 2. 优化redis
   * @return [type] [description]
   */
   public function index(){

      try {
        $ranks = model('News')->getRankNormalNews();
        $ranks = $this->getDealNews($ranks);
      } catch (Exception $e) {
        return new ApiException('error', 400);
      }

      return show(config('code.success'),'ok',$ranks,200);
   }

}